package com.zhuangjie.coupon.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhuangjie.coupon.entity.Coupon;
import com.zhuangjie.coupon.pojo.CouponCoreInfo;
import com.zhuangjie.coupon.pojo.RawValidCouponCount;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zhuangjie
 * @since 2024-02-28
 */
public interface CouponMapper extends BaseMapper<Coupon> {


    List<CouponCoreInfo> queryIssuedTypeAllEffectiveCoupons(@Param("userId") Long userId,@Param("shopId") Long shopId, @Param("issuedType") byte issuedType, @Param("state") Byte state);

    CouponCoreInfo queryValidExpandableCoupons(@Param("userId") Long userId, @Param("id") Long id, @Param("couponState") byte couponState, @Param("issuedType") byte issuedType);


    List<RawValidCouponCount> validCouponCount(@Param("userId") Long userId, @Param("couponState") byte couponState);

    List<CouponCoreInfo> queryUserShopCoupon(@Param("userId") Long userId, @Param("shopId") Long shopId, @Param("unusedCouponState") Byte unusedCouponState, @Param("shopShowObtainWay") Byte shopShowObtainWay, @Param("availableToClaimCouponBatchStatus") byte availableToClaimCouponBatchStatus );

    List<CouponCoreInfo> queryReceivedPlatformCoupon(@Param("userId") Long userId, @Param("issuedType") byte issuedType, @Param("unusedCouponState") byte unusedCouponState);

    List<CouponCoreInfo> queryReceivedOrPurchasablePlatformCoupon(@Param("userId") Long userId, @Param("issuedType") byte issuedType, @Param("unusedCouponState") byte unusedCouponState, @Param("productCouponBatchIds") List<Long> productCouponBatchIds, @Param("availableToClaimCouponBatchStatus") byte availableToClaimCouponBatchStatus);
    List<CouponCoreInfo> receiveSpecificBatchIdCoupon(@Param("shopId") Long shopId, @Param("batchIds") List<Long> batchIds,@Param("claimableCouponBatchStatus") byte claimableCouponBatchStatus);
}
